package io.renren.modules.materialcopy.service.impl;

import io.renren.modules.poschangedata.entity.PoschangeDataCopy1Entity;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.materialcopy.dao.MaterialTestCopy1Dao;
import io.renren.modules.materialcopy.entity.MaterialTestCopy1Entity;
import io.renren.modules.materialcopy.service.MaterialTestCopy1Service;

@Slf4j
@Service("materialTestCopy1Service")
public class MaterialTestCopy1ServiceImpl extends ServiceImpl<MaterialTestCopy1Dao, MaterialTestCopy1Entity> implements MaterialTestCopy1Service {

    @Autowired
     MaterialTestCopy1Dao materialTestCopy1Dao;
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<MaterialTestCopy1Entity> page = this.page(
                new Query<MaterialTestCopy1Entity>().getPage(params),
                //条件查询
                new QueryWrapper<MaterialTestCopy1Entity>().like("productNo",params.get("key"))
        );

        return new PageUtils(page);
    }

    @Override
    public List<PoschangeDataCopy1Entity> listMaterialFlowInfo(String productNo) {
        log.info("materialTestCopy1Dao.listMaterialFlowInfo(productNo) = " + materialTestCopy1Dao.listMaterialFlowInfo(productNo));
        System.out.println("materialTestCopy1Dao.listMaterialFlowInfo(productNo) = " + materialTestCopy1Dao.listMaterialFlowInfo(productNo));
        return materialTestCopy1Dao.listMaterialFlowInfo(productNo);
    }

    @Override
    public int insertMaterial(MaterialTestCopy1Entity materialTestCopy1) {
        return materialTestCopy1Dao.insertMaterial(materialTestCopy1);
    }


}